<?php
	$auth = Zend_Auth::getInstance();
	if ($auth->hasIdentity())	
		$u = $auth->getIdentity();
	$sess = new Zend_Session_Namespace(CLU_NS);
	$userPermission = $sess->userPermissions; 
	//die_a($userPermission);
?>
<script >
$(function(){
	var value = "<?=$sess->masterRequest;?>";
	$("#hmenu").find("ul").find("li").removeClass();
	switch (value)
	{
		case 'hvn/master/about-vietnam':{
			$("#aboutVN_menu").addClass("curent");
			break;
		}

		case 'hvn/master/home':{
			$("#home_menu").addClass("curent");
			break;
		}

		case 'event/master/home':{
			$("#event_menu").addClass("curent");
			break;
		}

		case 'news/master/tourism-guide':{
			$("#handbook_menu").addClass("curent");
			break;
		}

		case 'blog/master/blog-home':{
			$("#blog_menu").addClass("curent");
			break;
		}

		case 'promotion/master/search':{
			$("#gift_menu").addClass("curent");
			break;
		}
	}
//	
});
</script>
<?
    $uri = $_SERVER['REQUEST_URI']; 
    $requestUri = substr($uri,4);
    $requestModule = substr($uri,4,17);
//   die($requestModule);
?>
<?
    if($requestModule == "hvn/about-vietnam"){
    	$flag = "flag1";
		if ($sess->viewLang == "vi")
			$banner = "/public/themes/hard/swf/red_banner_vi.swf";
		else
			$banner = "/public/themes/hard/swf/red_banner_en.swf"; 
    }else{
    	$flag = "flag2";
    	if ($sess->viewLang == "vi")
			$banner = "/public/themes/hard/swf/blue_banner_vi.swf";
		else
			$banner = "/public/themes/hard/swf/blue_banner_en.swf"; 
    }
//    die($flag);
?>
<div class="<?=$flag?>" align="right" >
        <a href="/vi/<?= $requestUri?>"><img src="/public/themes/hard/images/flag-vi.jpg"    alt="Vietnamese" align="absmiddle"></a>&nbsp;&nbsp;
        <a href="/en/<?= $requestUri?>"><img src="/public/themes/hard/images/flag-eng.jpg"   alt="English"    align="absmiddle"></a>&nbsp;&nbsp;
        <a href="/cn/<?= $requestUri?>"><img src="/public/themes/hard/images/flag-china.jpg" alt="Chinese"    align="absmiddle"></a>&nbsp;&nbsp;
        <a href="#"><img src="/public/themes/hard/images/flag-japan.jpg" alt="Japanese"   align="absmiddle"></a>&nbsp;&nbsp;
</div>
<div>
 <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                        id="StorageAddress" width="1004" height="120"
                        codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
                        <param name="movie" value="<?=$banner?>" />
                     
                        <param name="quality" value="high" />
                        <param name="bgcolor" value="#000000" />
     					<param name="wmode" value="transparent" />
                        <param name="allowScriptAccess" value="sameDomain" />
                        <embed src="<?=$banner ?>" quality="high" bgcolor="#000000"
                                width="1004" height="120"
                                name="herevietnam" align="middle"
                                play="true"
                                loop="false"
                                quality="high"
                                wmode = "transparent"
                                allowScriptAccess="sameDomain"
                                type="application/x-shockwave-flash"
                                pluginspage="http://www.adobe.com/go/getflashplayer"
                                >
                        </embed>
        </object>
</div>

<div class="clear"></div>
<div id = "hmenu" class="menutop">
    <ul>
		<li id = "home_menu" class="curent"><a href="/<?=$sess->viewLang?>/"><?=t(463)?></a></li>
		<li id = "aboutVN_menu" ><a href="<?=$this->hvnUrl(array('action' => 'about-vietnam', 'module' => 'hvn'),'nocontroller')?>"><?=t(166)?></a></li>
		<li id = "event_menu"><a href="<?=$this->hvnUrl(array('action'=>'home', 'module'=>'event'), "nocontroller"); ?>"><?=t(202)?></a></li>
		<li id = "handbook_menu"><a href="<?=$this->hvnUrl(array('action'=>'tourism-guide', 'module'=>'node', 'controller'=>'news'), "generic"); ?>"><?=t(167)?></a></li>
        <li id = "blog_menu"><a href="<?=$this->hvnUrl(array('action'=>'blog-home', 'module'=>'node', 'controller'=>'blog'), "generic"); ?>"><?=t(98)?></a></li>
		<li id = "gift_menu"><a href="<?=$this->hvnUrl(array('action'=>'search', 'type'=>'promotion'), "node"); ?>?cluSearch=1&searchAll=1&asc_or_desc=desc"><?=t(171)?></a></li>
	</ul>
</div>
<div class="login_log" align="right">
    <table border="0" cellpadding="0" cellspacing="0" height="27" width="400">   
	    	<tr>
              <?if (isset($u)) :?>
              	<td class="username" align="right" width="140"><?=$u->name?> : &nbsp;</td>
    			<td align="right" valign="middle" width="95">
			    	  <div class="login_left"></div>
		              <div class="login_center">
		              <ul class="jsddm" >
		                    <li><a href="javascript:void()"><?=t(182)?></a>
		                      <ul style="margin:0 0 0 -10px;*margin:18px 0 0 -50px;">
	                            <li><a href="<?=$this->hvnUrl(array('action' => 'view'),'account')?>?id=<?=$u->id?>"><?=t(6206)?></a></li> 
								<!--<li><a href="<?=$this->hvnUrl(array('action' => 'edit-profile'),'account')?>?id=<?=$u->id?>"><?=t(6204)?></a></li>-->
								<li> <a href="<?=$this->hvnUrl(array("module" => "user",
													"action" => "mailbox"),
 													"account")?>?status=-1" ><?=t(1017)?></a></li>									
								<li><a href="<?=$this->hvnUrl(array('action' => 'view-posts'),'account')?>?id=<?=$u->id?>&content_type=blog"><?=t(5011)?> </a></li>
								<li><a href="<?=$this->hvnUrl(array('action' => 'logout'),'account')?>"><?=t(437)?> </a></li>
		                      </ul>
		                    </li>
		              </ul>
		              </div>
		              
		              <div class="login_right"></div>
		        </td>
		              
			    <td width="95"><div class="login_left"></div>
		              <div class="login_center">
		               <ul class="jsddm" >
		                    <li><a href="javascript:void()"><?=t(627)?></a>
		                         <ul style="margin:0 0 0 -30px; *margin:18px 0 0 -90px;">
		                            <li><a href="<?=$this->hvnUrl(array('action' => 'search', 'module' => 'place'),'nocontroller')?>?cluSearch=1"><?=t(701)?></a></li>
						            <li><a href="<?=$this->hvnUrl(array('action' => 'search', 'module' => 'event'),'nocontroller')?>?cluSearch=1"><?=t(202)?></a></li>
						            <li><a href="<?=$this->hvnUrl(array('action' => 'search', 'type' => 'gallery'),'node')?>?cluSearch=1&searchAll=1"><?=t(6)?></a></li>
						            <li><a href="<?=$this->hvnUrl(array('action' => 'search', 'type' => 'news'),'node')?>?cluSearch=1&searchAll=1"><?=t(301)?></a></li>
						            <li><a href="<?=$this->hvnUrl(array('action' => 'search', 'type' => 'blog'),'node')?>"><?=t(98)?></a></li>
						            <?if (strpos($userPermission,'administer ads')) :?>	
							            <li><a href="<?=$this->hvnUrl(array('action' => 'search', 'module' => 'ads'),'nocontroller')?>"><?=t(170)?></a></li>
			            			<?endif ?>
									<?if (strpos($userPermission,'translate article')) :?>
						            <li><a href="<?=$this->hvnUrl(array('action' => 'search', 'module' => 'article'),'nocontroller')?>"><?=t(6203)?></a></li>
						            <?endif ?>
									<?if (strpos($userPermission,'administer everything')) :?>
						                <li><a href="<?=$this->hvnUrl(array('action' => 'search', 'module' => 'category'),'nocontroller')?>">Category</a></li>
						                <li><a href="/en/user/role/list">List roles</a></li>
						            <?endif ?>
						            <?if (strpos($userPermission,'administer everything') || strpos($userPermission,'update user')) :?>
						                <li><a href="<?=$this->hvnUrl(array('action' => 'search'),'usersearch')?>"><?=t(404)?></a></li>
						            <?endif?>
		                        </ul>
		                    </li>
		              </ul>
		              </div>
		              <div class="login_right"></div>
			    </td>
			    <td width="85">
		              <div class="login_left"></div>
		              <div class="login_center">
		               <ul class="jsddm">
		                    <li><a href="javascript:void()" >Upload</a>
		                         <ul style="margin:0 0 0 -95px; *margin:18px 0 0 -135px;">
		                         	<?if (strpos($userPermission,'create place')) :?>
		                            <li><a href="<?=$this->hvnUrl(array('action' => 'new', 'module' => 'place'),'nocontroller')?>"><?=t(701)?></a></li>
		                            <?endif?>
		                            <?if (strpos($userPermission,'create event')) :?>
						            <li><a href="<?=$this->hvnUrl(array('action' => 'new', 'module' => 'event'),'nocontroller')?>"><?=t(202)?></a></li>
						            <?endif?>
						            <?if (strpos($userPermission,'create gallery')) :?>
						            <li><a href="<?=$this->hvnUrl(array('action' => 'new', 'type' => 'gallery'),'node')?>"><?=t(6202)?></a></li>
						            <?endif?>
						            <?if (strpos($userPermission,'create news')) :?>
						            <li><a href="<?=$this->hvnUrl(array('action' => 'new', 'type' => 'news'),'node')?>"><?=t(6201)?></a></li>
						            <?endif?>
						            <?if (strpos($userPermission,'create blog')) :?>
						            <li><a href="<?=$this->hvnUrl(array('action' => 'new', 'type' => 'blog'),'node')?>"><?=t(98)?></a></li>
						            <?endif?>
						            <?if (strpos($userPermission,'administer ads') || in_array(get_key('registered_company_role_id'), $this->viewParams['role_id'])) :?>	
							            <li><a href="<?=$this->hvnUrl(array('action' => 'new', 'module' => 'ads'),'nocontroller')?>"><?=t(170)?></a></li>
			            			<?endif ?>
						            <?if(in_array(get_key('registered_company_role_id'), $this->viewParams['role_id']) || strpos($sess->userPermissions, 'administer everything')) :?>
						            <li><a href="<?=$this->hvnUrl(array('action' => 'new', 'type' => 'promotion'),'node')?>"><?=t(6205)?></a></li>
						            <?endif?>
						            <?if (strpos($userPermission,'administer everything')) :?>	
							            <li><a href="<?=$this->hvnUrl(array('action' => 'new', 'module' => 'category'),'nocontroller')?>"><?=t(779)?></a></li>
							            <li><a href="/en/user/role/new">Role</a></li>
							            <li><a href="<?=$this->hvnUrl(array('action' => 'moderate-category', 'module' => 'category'),'nocontroller')?>">Mod Category</a></li>
			            			<?endif ?>
		                        </ul>
		                    </li>
		              </ul>
		              </div>
		              <div class="login_right"></div>
			    </td>
              <?else: ?>
		        <td class="username" align="right" width="133"></td>
                <td width="100">
				  <div class="login_left"></div>
				  <div class="login_center">
				   <ul class="jsddm">
						<li><a href="javascript:void()"><?=t(627)?></a>
							 <ul style="margin: 0pt 0pt 0pt -30px;">
								<li><a href="<?=$this->hvnUrl(array('action' => 'search', 'module' => 'place'),'nocontroller')?>?cluSearch=1"><?=t(701)?></a></li>
					            <li><a href="<?=$this->hvnUrl(array('action' => 'search', 'module' => 'event'),'nocontroller')?>?cluSearch=1"><?=t(202)?></a></li>
					            <li><a href="<?=$this->hvnUrl(array('action' => 'search', 'type' => 'gallery'),'node')?>?cluSearch=1&searchAll=1"><?=t(6)?></a></li>
					            <li><a href="<?=$this->hvnUrl(array('action' => 'search', 'type' => 'news'),'node')?>?cluSearch=1&searchAll=1"><?=t(6201)?></a></li>
					            <li><a href="<?=$this->hvnUrl(array('action' => 'search', 'type' => 'blog'),'node')?>"><?=t(98)?></a></li>
					            <li><a href="<?=$this->hvnUrl(array('action' => 'search', 'type' => 'promotion'),'node')?>"><?=t(6205)?></a></li>
							</ul>  
						</li>
				  </ul>
				  </div>
				  <div class="login_right"></div>  
				</td>
                <td width="244"> 
                	<div class="login_left"></div>
                	<div class="login_center">
                   		<a href="<?=$this->hvnUrl(array('action' => 'register'),'account')?>"><?=t(423) ?></a> | 
                		<a href="#loginForm" class="loginDOMWindow"><?=t(411)?></a>
                   	</div>
                	<div class="login_right"></div>
                	
                	<div id="loginForm" style="display: none;color: gray;" align="center">
                	  <div class="clear"></div>
                 <div class="chitiet_bar_ajax" style="width: 100%">&nbsp;&nbsp;<?=t(433) ?></div>
          		<br /><br /><br />
                        <form id="loginFormAjax" accept-charset="UTF-8" action="<?=$this->hvnUrl(array('action' => 'login'),'account')?>" method="POST">

							<? if(isset($_POST["name"])):?>
                                  <div align="center"><img src="/public/themes/hard/images/wait.gif" align="middle"></img></div> 
                            <?endif?>
                                 
                           <b><?=t(434) ?></b>:<br/><input type="text" value="" id="name" name="name" style="border:1px solid #55b0d6; margin: 0 0 0 40px;"/>
                           <br/>
                                 <br/>
                           <b><?=t(432) ?></b>: <br/><input type="password" value="" id="pass" name="pass" style="border:1px solid #55b0d6;margin: 0 0 0 40px;"/><br/>
                                <br/>
                                <div id="id_1" align="center" style="color:red; " >
                           <input type="submit" value="Login" name="submit" id="submitForm" 
                           style="background:url('/public/themes/prime/images/login2.png') no-repeat;width:54px;height:19px;border:none;color:white;font-weight:bold;font-family:tahoma;
                           	"/></div>
                           <br/>
                           <a style="color:#ff0000;" href="<?=$this->hvnUrl(array('action' => 'remind-password', 'controller' => "account", "module" => "user"),'generic')?>" > <?=t(464) ?> ? </a>
                        </form>
	                </div> 
                </td>

					<script type="text/javascript">
					$(function() {
						$('.loginDOMWindow').openDOMWindow({ 
					                        height:'220', 
					                        width:'250', 
					                        positionType:'centered', 
					                        positionTop:250, 
					                        eventType:'click', 
					                        positionLeft:'100', 
					                        windowSourceID:'#loginForm', 
					                        windowPadding:'5', 
					                        /*draggable:1,*/ 
					                        windowBGColor:'#FFFFFF', 
					                        borderColor:'#243e89',
					                        borderSize: '12'
					                     //   overlayOpacity:'40', 
					 	});  
					});
					</script>
		<? if(isset($_POST["submit"])):?>			
		<script type="text/javascript">		
					$(function() {                 
		                $("#loginFormAjax").ajaxForm({
	                        dataType: 'json',
	                        success: function(json)
	                        {
	                        	if(typeof(json.success) == "undefined")
	                        	{
									window.location.href = "/<?=$sess->viewLang?>/register";
	                        	}
	                            else
	                            {
	                            	if (json.success)
	                            	{
						                var p = /^\/(en|vi|jp|cn|fr|kr)\/logout$/;
						                if (p.test(window.location.pathname))
						                {
						                	//redirect to home
						                	window.location.href = "/";
						                }
						                else
		    	                            window.location.reload();
		    	                    }
		    	                    else 
		    	                    	window.location.href = "/<?=$sess->viewLang?>/register";
	                            }        
	                           
	                        }
		                });
					});
					</script>
		 <?endif?>
			  <?endif ?>
		    </tr>
	</table>  
</div>
